def copy(filename='', source='', target=''):
    try:
        f=open(source+ '\\' + filename, "rb")
        t=open(target + '\\' + filename, "xb")
    except FileNotFoundError:
        print("源文件不存在")
    except FileExistsError:
            print("目标文件已存在")
    else:
        content = f.read()
        t.write(content)
        f.close
        t.close
        print("文件复制完毕")

copy('copy.txt', r"F:\homework\folder1", r'F:\homework\folder2')

"""
可以尝试使用下shutil模块试下
"""
import shutil
def copy(filename='', source='', target=''):
    try:
        shutil.copy(source + '\\' + filename , target ,follow_symlinks = True)
    except Exception as e:
        print(e)
    else:
        print("文件复制完成")
